<? if ($c = stack('name')) {

	$temp = array();

	$t = datafetch('db_item', 'cs_claim', "person_id=" . gccUserInfo('person_id'), 'count(*) as draft_count');
	$temp['draft_count'] = $t['draft_count'];

	$t = datafetch('db_item', 'cc_document', "person_id=" . gccUserInfo('person_id'), 'count(*) as sent_count');
	$temp['sent_count'] = $t['sent_count'];

	$temp['claims'] = datafetch_array('db_list', array('table' => 'cs_claim
			left join cr_classificator_value v1 on cs_claim.question_id = v1.id
			left join cc_geo_object geo on (cs_claim.region_id = geo.id)
			left join cc_geo_property geop on (geo.property_id = geop.id)
			',
		'index' => 'id',
		'where' => 'person_id = '.gccUserInfo('person_id'),
		'select' => "cs_claim.id, cs_claim.issue, TO_CHAR(cs_claim.create_date, 'YYYY-MM-DD') c_date, cs_claim.create_date, v1.name question, geop.koatuu_name region, cs_claim.region_id region_id",
		'order' => 'cs_claim.create_date DESC'
	));


	$DATA['components'][$c]['data'] = $temp;

	unstack();
}